/*
 * @Author: lsmi
 * @Date: 2021-06-08 20:33:28
 * @LastEditors: lsmi
 * @LastEditTime: 2021-12-01 20:22:08
 * @FilePath: \v2_play_js\src\router\index.js
 */
import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue"),
  },
  {
    path: "/test-swiper",
    component: () => import("../views/TestSwiper.vue"),
  },
  {
    path: "/test",
    component: () => import("../views/Test.vue"),
  },
  {
    path: "/audio",
    component: () => import("../views/Audio.vue"),
  },
  {
    path: "/canvas",
    component: () => import("../views/Canvas.vue"),
  },
  {
    path: "/szmap",
    component: () => import("../views/szMap.vue"),
  },
  {
    path: "/szmap2",
    component: () => import("../views/szMap2.vue"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

router.beforeEach((to, form, next) => {
  next();
});
setTimeout(() => {
  router.addRoutes([
    {
      path: "/add-routers",
      component: () => import("../views/AddRouters.vue"),
    },
  ]);
}, 2000);

export default router;
